(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
times(x, y) → sum(generate(x, y))
generate(x, y) → gen(x, y, 0)
gen(x, y, z) → if(ge(z, x), x, y, z)
if(true, x, y, z) → nil
if(false, x, y, z) → cons(y, gen(x, y, s(z)))
sum(nil) → 0
sum(cons(0, xs)) → sum(xs)
sum(cons(s(x), xs)) → s(sum(cons(x, xs)))
ge(x, 0) → true
ge(0, s(y)) → false
ge(s(x), s(y)) → ge(x, y)
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
sum(cons(0, xs)) →+ sum(xs)
gives rise to a decreasing loop by considering the right hand sides subterm at position [].
The pumping substitution is [xs / cons(0, xs)].
The result substitution is [ ].
(2) BOUNDS(n^1, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
times(x, y) → sum(generate(x, y))
generate(x, y) → gen(x, y, 0')
gen(x, y, z) → if(ge(z, x), x, y, z)
if(true, x, y, z) → nil
if(false, x, y, z) → cons(y, gen(x, y, s(z)))
sum(nil) → 0'
sum(cons(0', xs)) → sum(xs)
sum(cons(s(x), xs)) → s(sum(cons(x, xs)))
ge(x, 0') → true
ge(0', s(y)) → false
ge(s(x), s(y)) → ge(x, y)
S is empty.
Rewrite Strategy: FULL
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
TRS:
Rules:
times(x, y) → sum(generate(x, y))
generate(x, y) → gen(x, y, 0')
gen(x, y, z) → if(ge(z, x), x, y, z)
if(true, x, y, z) → nil
if(false, x, y, z) → cons(y, gen(x, y, s(z)))
sum(nil) → 0'
sum(cons(0', xs)) → sum(xs)
sum(cons(s(x), xs)) → s(sum(cons(x, xs)))
ge(x, 0') → true
ge(0', s(y)) → false
ge(s(x), s(y)) → ge(x, y)
Types:
times :: 0':s → 0':s → 0':s
sum :: nil:cons → 0':s
generate :: 0':s → 0':s → nil:cons
gen :: 0':s → 0':s → 0':s → nil:cons
0' :: 0':s
if :: true:false → 0':s → 0':s → 0':s → nil:cons
ge :: 0':s → 0':s → true:false
true :: true:false
nil :: nil:cons
false :: true:false
cons :: 0':s → nil:cons → nil:cons
s :: 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
hole_true:false3_0 :: true:false
gen_0':s4_0 :: Nat → 0':s
gen_nil:cons5_0 :: Nat → nil:cons
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
sum,
gen,
geThey will be analysed ascendingly in the following order:
ge < gen
(8) Obligation:
TRS:
Rules:
times(
x,
y) →
sum(
generate(
x,
y))
generate(
x,
y) →
gen(
x,
y,
0')
gen(
x,
y,
z) →
if(
ge(
z,
x),
x,
y,
z)
if(
true,
x,
y,
z) →
nilif(
false,
x,
y,
z) →
cons(
y,
gen(
x,
y,
s(
z)))
sum(
nil) →
0'sum(
cons(
0',
xs)) →
sum(
xs)
sum(
cons(
s(
x),
xs)) →
s(
sum(
cons(
x,
xs)))
ge(
x,
0') →
truege(
0',
s(
y)) →
falsege(
s(
x),
s(
y)) →
ge(
x,
y)
Types:
times :: 0':s → 0':s → 0':s
sum :: nil:cons → 0':s
generate :: 0':s → 0':s → nil:cons
gen :: 0':s → 0':s → 0':s → nil:cons
0' :: 0':s
if :: true:false → 0':s → 0':s → 0':s → nil:cons
ge :: 0':s → 0':s → true:false
true :: true:false
nil :: nil:cons
false :: true:false
cons :: 0':s → nil:cons → nil:cons
s :: 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
hole_true:false3_0 :: true:false
gen_0':s4_0 :: Nat → 0':s
gen_nil:cons5_0 :: Nat → nil:cons
Generator Equations:
gen_0':s4_0(0) ⇔ 0'
gen_0':s4_0(+(x, 1)) ⇔ s(gen_0':s4_0(x))
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(0', gen_nil:cons5_0(x))
The following defined symbols remain to be analysed:
sum, gen, ge
They will be analysed ascendingly in the following order:
ge < gen
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
sum(
gen_nil:cons5_0(
n7_0)) →
gen_0':s4_0(
0), rt ∈ Ω(1 + n7
0)
Induction Base:
sum(gen_nil:cons5_0(0)) →RΩ(1)
0'
Induction Step:
sum(gen_nil:cons5_0(+(n7_0, 1))) →RΩ(1)
sum(gen_nil:cons5_0(n7_0)) →IH
gen_0':s4_0(0)
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
TRS:
Rules:
times(
x,
y) →
sum(
generate(
x,
y))
generate(
x,
y) →
gen(
x,
y,
0')
gen(
x,
y,
z) →
if(
ge(
z,
x),
x,
y,
z)
if(
true,
x,
y,
z) →
nilif(
false,
x,
y,
z) →
cons(
y,
gen(
x,
y,
s(
z)))
sum(
nil) →
0'sum(
cons(
0',
xs)) →
sum(
xs)
sum(
cons(
s(
x),
xs)) →
s(
sum(
cons(
x,
xs)))
ge(
x,
0') →
truege(
0',
s(
y)) →
falsege(
s(
x),
s(
y)) →
ge(
x,
y)
Types:
times :: 0':s → 0':s → 0':s
sum :: nil:cons → 0':s
generate :: 0':s → 0':s → nil:cons
gen :: 0':s → 0':s → 0':s → nil:cons
0' :: 0':s
if :: true:false → 0':s → 0':s → 0':s → nil:cons
ge :: 0':s → 0':s → true:false
true :: true:false
nil :: nil:cons
false :: true:false
cons :: 0':s → nil:cons → nil:cons
s :: 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
hole_true:false3_0 :: true:false
gen_0':s4_0 :: Nat → 0':s
gen_nil:cons5_0 :: Nat → nil:cons
Lemmas:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
Generator Equations:
gen_0':s4_0(0) ⇔ 0'
gen_0':s4_0(+(x, 1)) ⇔ s(gen_0':s4_0(x))
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(0', gen_nil:cons5_0(x))
The following defined symbols remain to be analysed:
ge, gen
They will be analysed ascendingly in the following order:
ge < gen
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
ge(
gen_0':s4_0(
n284_0),
gen_0':s4_0(
n284_0)) →
true, rt ∈ Ω(1 + n284
0)
Induction Base:
ge(gen_0':s4_0(0), gen_0':s4_0(0)) →RΩ(1)
true
Induction Step:
ge(gen_0':s4_0(+(n284_0, 1)), gen_0':s4_0(+(n284_0, 1))) →RΩ(1)
ge(gen_0':s4_0(n284_0), gen_0':s4_0(n284_0)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(13) Complex Obligation (BEST)
(14) Obligation:
TRS:
Rules:
times(
x,
y) →
sum(
generate(
x,
y))
generate(
x,
y) →
gen(
x,
y,
0')
gen(
x,
y,
z) →
if(
ge(
z,
x),
x,
y,
z)
if(
true,
x,
y,
z) →
nilif(
false,
x,
y,
z) →
cons(
y,
gen(
x,
y,
s(
z)))
sum(
nil) →
0'sum(
cons(
0',
xs)) →
sum(
xs)
sum(
cons(
s(
x),
xs)) →
s(
sum(
cons(
x,
xs)))
ge(
x,
0') →
truege(
0',
s(
y)) →
falsege(
s(
x),
s(
y)) →
ge(
x,
y)
Types:
times :: 0':s → 0':s → 0':s
sum :: nil:cons → 0':s
generate :: 0':s → 0':s → nil:cons
gen :: 0':s → 0':s → 0':s → nil:cons
0' :: 0':s
if :: true:false → 0':s → 0':s → 0':s → nil:cons
ge :: 0':s → 0':s → true:false
true :: true:false
nil :: nil:cons
false :: true:false
cons :: 0':s → nil:cons → nil:cons
s :: 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
hole_true:false3_0 :: true:false
gen_0':s4_0 :: Nat → 0':s
gen_nil:cons5_0 :: Nat → nil:cons
Lemmas:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
ge(gen_0':s4_0(n284_0), gen_0':s4_0(n284_0)) → true, rt ∈ Ω(1 + n2840)
Generator Equations:
gen_0':s4_0(0) ⇔ 0'
gen_0':s4_0(+(x, 1)) ⇔ s(gen_0':s4_0(x))
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(0', gen_nil:cons5_0(x))
The following defined symbols remain to be analysed:
gen
(15) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol gen.
(16) Obligation:
TRS:
Rules:
times(
x,
y) →
sum(
generate(
x,
y))
generate(
x,
y) →
gen(
x,
y,
0')
gen(
x,
y,
z) →
if(
ge(
z,
x),
x,
y,
z)
if(
true,
x,
y,
z) →
nilif(
false,
x,
y,
z) →
cons(
y,
gen(
x,
y,
s(
z)))
sum(
nil) →
0'sum(
cons(
0',
xs)) →
sum(
xs)
sum(
cons(
s(
x),
xs)) →
s(
sum(
cons(
x,
xs)))
ge(
x,
0') →
truege(
0',
s(
y)) →
falsege(
s(
x),
s(
y)) →
ge(
x,
y)
Types:
times :: 0':s → 0':s → 0':s
sum :: nil:cons → 0':s
generate :: 0':s → 0':s → nil:cons
gen :: 0':s → 0':s → 0':s → nil:cons
0' :: 0':s
if :: true:false → 0':s → 0':s → 0':s → nil:cons
ge :: 0':s → 0':s → true:false
true :: true:false
nil :: nil:cons
false :: true:false
cons :: 0':s → nil:cons → nil:cons
s :: 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
hole_true:false3_0 :: true:false
gen_0':s4_0 :: Nat → 0':s
gen_nil:cons5_0 :: Nat → nil:cons
Lemmas:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
ge(gen_0':s4_0(n284_0), gen_0':s4_0(n284_0)) → true, rt ∈ Ω(1 + n2840)
Generator Equations:
gen_0':s4_0(0) ⇔ 0'
gen_0':s4_0(+(x, 1)) ⇔ s(gen_0':s4_0(x))
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(0', gen_nil:cons5_0(x))
No more defined symbols left to analyse.
(17) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
(18) BOUNDS(n^1, INF)
(19) Obligation:
TRS:
Rules:
times(
x,
y) →
sum(
generate(
x,
y))
generate(
x,
y) →
gen(
x,
y,
0')
gen(
x,
y,
z) →
if(
ge(
z,
x),
x,
y,
z)
if(
true,
x,
y,
z) →
nilif(
false,
x,
y,
z) →
cons(
y,
gen(
x,
y,
s(
z)))
sum(
nil) →
0'sum(
cons(
0',
xs)) →
sum(
xs)
sum(
cons(
s(
x),
xs)) →
s(
sum(
cons(
x,
xs)))
ge(
x,
0') →
truege(
0',
s(
y)) →
falsege(
s(
x),
s(
y)) →
ge(
x,
y)
Types:
times :: 0':s → 0':s → 0':s
sum :: nil:cons → 0':s
generate :: 0':s → 0':s → nil:cons
gen :: 0':s → 0':s → 0':s → nil:cons
0' :: 0':s
if :: true:false → 0':s → 0':s → 0':s → nil:cons
ge :: 0':s → 0':s → true:false
true :: true:false
nil :: nil:cons
false :: true:false
cons :: 0':s → nil:cons → nil:cons
s :: 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
hole_true:false3_0 :: true:false
gen_0':s4_0 :: Nat → 0':s
gen_nil:cons5_0 :: Nat → nil:cons
Lemmas:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
ge(gen_0':s4_0(n284_0), gen_0':s4_0(n284_0)) → true, rt ∈ Ω(1 + n2840)
Generator Equations:
gen_0':s4_0(0) ⇔ 0'
gen_0':s4_0(+(x, 1)) ⇔ s(gen_0':s4_0(x))
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(0', gen_nil:cons5_0(x))
No more defined symbols left to analyse.
(20) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
(21) BOUNDS(n^1, INF)
(22) Obligation:
TRS:
Rules:
times(
x,
y) →
sum(
generate(
x,
y))
generate(
x,
y) →
gen(
x,
y,
0')
gen(
x,
y,
z) →
if(
ge(
z,
x),
x,
y,
z)
if(
true,
x,
y,
z) →
nilif(
false,
x,
y,
z) →
cons(
y,
gen(
x,
y,
s(
z)))
sum(
nil) →
0'sum(
cons(
0',
xs)) →
sum(
xs)
sum(
cons(
s(
x),
xs)) →
s(
sum(
cons(
x,
xs)))
ge(
x,
0') →
truege(
0',
s(
y)) →
falsege(
s(
x),
s(
y)) →
ge(
x,
y)
Types:
times :: 0':s → 0':s → 0':s
sum :: nil:cons → 0':s
generate :: 0':s → 0':s → nil:cons
gen :: 0':s → 0':s → 0':s → nil:cons
0' :: 0':s
if :: true:false → 0':s → 0':s → 0':s → nil:cons
ge :: 0':s → 0':s → true:false
true :: true:false
nil :: nil:cons
false :: true:false
cons :: 0':s → nil:cons → nil:cons
s :: 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_nil:cons2_0 :: nil:cons
hole_true:false3_0 :: true:false
gen_0':s4_0 :: Nat → 0':s
gen_nil:cons5_0 :: Nat → nil:cons
Lemmas:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
Generator Equations:
gen_0':s4_0(0) ⇔ 0'
gen_0':s4_0(+(x, 1)) ⇔ s(gen_0':s4_0(x))
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(0', gen_nil:cons5_0(x))
No more defined symbols left to analyse.
(23) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
sum(gen_nil:cons5_0(n7_0)) → gen_0':s4_0(0), rt ∈ Ω(1 + n70)
(24) BOUNDS(n^1, INF)